package com.rabbitmq;

import com.rabbitmq.service.SendService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.Resource;

@SpringBootApplication
public class Application implements CommandLineRunner {
    @Resource
    private SendService sendService;
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
//        for(int i=0;;i++){
//            sendService.directSend("SpringBoot测试消息"+i);
//        }
//        sendService.directSend("SpringBoot测试消息");
//        sendService.fanoutSend("Fanout测试消息");
        String routingKey="aa.bb.cc";
        String message="Topic测试消息, RoutingKey:"+routingKey;
        sendService.topicSend(message,routingKey);
    }
}
